package com.ytjj.qmyx.admin.service.impl;

import com.github.pagehelper.PageHelper;
import com.ytjj.common.api.CommonPage;
import com.ytjj.common.api.CommonResult;
import com.ytjj.qmyx.admin.dao.NavDao;
import com.ytjj.qmyx.admin.model.request.NavRequest;
import com.ytjj.qmyx.admin.model.response.NavResponse;
import com.ytjj.qmyx.admin.service.NavService;
import com.ytjj.qmyx.mall.model.Nav;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;

import javax.annotation.Resource;
import java.util.List;

@Slf4j
@Service
public class NavServiceImpl implements NavService {

    @Resource
    private NavDao navDao;

    @Override
    public CommonPage<NavResponse> queryNavList(NavRequest navRequest) {
        PageHelper.startPage(navRequest.getPageNum(), navRequest.getPageSize());
        List<NavResponse> page = navDao.queryNavList(navRequest);
        return CommonPage.restPage(page);
    }

    @Override
    public int insertNav(NavRequest navRequest) {
        return navDao.insertNav(navRequest);
    }

    @Override
    public int updateNav(NavRequest navRequest) {
        return navDao.updateNav(navRequest);
    }

    @Override
    public int deleteNav(Integer id) {
        return navDao.deleteNav(id);
    }

}
